// miniprogram/pages/devTools/devTools.js
import {
  colorui,
  imgfilter,
  transition,
  commapi,
  device,
  animation,
  keyboard,
  waterfall
} from '../../router'
Page({

  data: {
    list: [{
      id: 'form',
      name: '界面',
      open: false,
      pages: [{
        name: '颜色',
        path: colorui
      }, {
        name: '图片滤镜',
        path: imgfilter
      }, {
        name: '动画效果',
        path: animation
      }]
    }, {
      id: 'special',
      name: '开放接口',
      open: false,
      pages: [{
        name: '公共',
        path: commapi
      }, {
        name: '设备能力',
        path: device
      }]
    }, {
      id: 'custom',
      name: '自定义组件',
      open: false,
      pages: [{
        name: '键盘',
        path: keyboard
      }, {
        name: '瀑布流',
        path: waterfall
      }]
    }]
  },
  // , {
  //   name: '动画',
  //   path: transition
  // }
  onLoad: function (options) {

  },

  onShareAppMessage: function () {

  },
  kindToggle: function (e) {
    const id = e.currentTarget.id,
      list = this.data.list
    for (let i = 0, len = list.length; i < len; ++i) {
      if (list[i].id == id) {
        list[i].open = !list[i].open
      } else {
        list[i].open = false
      }
    }
    this.setData({
      list: list
    })
  },
})